﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;

namespace CodeGame
{
    class GameEntity : Entity
    {
        public string ID;

        public int X;
        public int Y;

        public Color Tint = new Color(255, 255, 255);
        public string Texture = "entity";

        public float Angle = 0f;

        public bool Spawned = false;

        public GameEntity(string id, int x, int y, int angle, string texture, int tintr, int tintg, int tintb)
        {
            this.ID = id;
            this.X = x;
            this.Y = y;
            this.Angle = angle;
            this.Texture = texture;
            this.Tint = new Color(tintr, tintg, tintb);

            if (this.X != 0)
            {
                this.Spawn();
            }
        }

        public void Spawn()
        {
            this.Spawned = true;
        }

        public void Move(int x, int y, float angle)
        {
            if (!this.Spawned)
            {
                this.Spawn();
            }
            this.X = x;
            this.Y = y;
            this.Angle = angle;
        }

        public override void Draw()
        {
            if (this.Spawned)
            {
                Singletons.CurrentWorld.DrawImage(this.Texture, this.X, this.Y, this.Angle, this.Tint);
            }
        }

    }
}
